package com.ordconsumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.pojo.Staff;
import com.service.StaffService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
@CrossOrigin //(origins = {"http://localhost:8088/"})//跨域问题
@RequestMapping("/staff")
public class StaffController {

    @Reference
    private StaffService ctService;

    @CrossOrigin
    @RequestMapping("/staffList")
    public List<Staff> getStaffList(){return ctService.getAllStaffs();}

    @CrossOrigin
    @PostMapping("/staffInfo")
    public Staff getStaffInfoByCode(@RequestParam(value="staffCode")String staffCode){
        return ctService.getStaffByCode(staffCode);

    }
}



